<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'wage_toadd.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css" href="css/emp_add.css">
<link href="css/sunny/jquery-ui-1.10.2.custom.css" rel="stylesheet">
<script src="js/jquery/jquery-1.9.1.js"></script>
<script src="js/jquery/jquery-ui-i18n.js"></script>
<script src="js/jquery/jquery-ui-1.10.2.custom.js"></script>
<script language="javascript" type="text/javascript"
	src="<%=basePath%>My97DatePicker/WdatePicker.js"></script>
<script>
	function Change_Select() {//当第一个下拉框的选项发生改变时调用该函数
		$.ajax({
			url : "employeeAction!listEmployeeByDeptId.action",
			data : {
				dept_id : $("#deptid").val()
			},
			success : function(data) {
				$("#emp_name").html(data);
			}
		});
	}
</script>
</head>

<body>
	<c:choose>
		<c:when test="${param.del!=null}">
			<sql:update var="result">
			delete from t_employee where emp_id=${param.emp_id}
			</sql:update>
			 <h1>员工删除成功</h1>
		</c:when>
		<c:otherwise>
			<h3>选择要删除的员工</h3>
			<div id="container">
				<form id="fm-form" method="post"
					action="admin/emp_todelete.jsp">
					<fieldset>
						<div class="fm-req">
							<label for="fm-firstname">部门</label> <select
								onChange="Change_Select()" name="job.job_dept" id="deptid">
								<sql:query var="result"
									sql="select dept_id,dept_name from t_department" />
								<!--第一个下拉菜单-->
								<option value="0">请选择</option>
								<c:forEach var="row" items="${result.rows}">
									<option value="${row.dept_id}">${row.dept_name}</option>
								</c:forEach>
							</select>
						</div>
						<div class="fm-req">
							<label for="fm-firstname">员工姓名</label> <select id="emp_name"
								name="emp_id"></select>
						</div>
						
					</fieldset>
					<div id="fm-submit" class="fm-req">
						<input name="del" value="del" type="hidden">
						<input name="Submit" value="&#25552; &#20132;" type="submit">
					</div>
					<br>
				</form>
			</div>
		</c:otherwise>
	</c:choose>

</body>
</html>
